1
The Challenge of Changing Requirements
AI033 Lesson 2
00:00

Imagine a local orchard owner who initially only needs to track "Green Apples" for a tart recipe. As the season progresses, they suddenly need "Red Apples" for cider. If your software is hardcoded for GREEN, you are trapped in a cycle of constant recompilation.

1. The Rigidity of Hardcoding

Methods like filterGreenApples are brittle. They bake specific business rules directly into the control flow. Every minor change (like a new color) requires a full deployment, creating a codebase that resists change rather than embracing it.

if (GREEN.equals(...))RIGID (Hardcoded)if (apple.getColor() .equals(color))Color ParameterFLEXIBLE (Parameterized)

2. The Duplication Trap

Without behavior parameterization, developers often fall into copy-paste programming. Creating near-identical methods for every new requirement increases the surface area for bugs and maintenance overhead exponentially. Value parameterization is the first defense: passing the color as an argument to make the logic reusable.

main.py
TERMINAL bash — 80x24
> Ready. Click "Run" to execute.
>